package com.vibeplayer.app.model;

import java.util.ArrayList;
import java.util.List;

/**
 * 播放列表数据模型类
 */
public class Playlist {
    private long id;
    private String name;
    private List<Song> songs;
    private long dateCreated;
    
    public Playlist(long id, String name, long dateCreated) {
        this.id = id;
        this.name = name;
        this.dateCreated = dateCreated;
        this.songs = new ArrayList<>();
    }
    
    public long getId() {
        return id;
    }
    
    public String getName() {
        return name;
    }
    
    public void setName(String name) {
        this.name = name;
    }
    
    public List<Song> getSongs() {
        return songs;
    }
    
    public void setSongs(List<Song> songs) {
        this.songs = songs;
    }
    
    public void addSong(Song song) {
        if (!songs.contains(song)) {
            songs.add(song);
        }
    }
    
    public void removeSong(Song song) {
        songs.remove(song);
    }
    
    public int getSongCount() {
        return songs.size();
    }
    
    public long getDateCreated() {
        return dateCreated;
    }
    
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        
        Playlist playlist = (Playlist) o;
        return id == playlist.id;
    }
    
    @Override
    public int hashCode() {
        return (int) (id ^ (id >>> 32));
    }
} 